export default {
  namespace: 'modal',
  state: {
    publishModal: {
      visible: false,
      currentKey: '',
      taskList: [],
      version: '',
    },
  },

  effects: {
    *showPublish({ payload, callback }, { call, put }) {
      yield put({
        type: 'changePublishVisible',
        payload: { visible: true, currentKey: payload.currentKey, taskList: payload.taskList, version: payload.version },
      });
    },
    *hidePublish(_, { call, put }) {
      yield put({
        type: 'changePublishVisible',
        payload: { visible: false },
      });
    },
  },

  reducers: {
    changePublishVisible(state, action) {
      return {
        ...state,
        publishModal: { ...state.publishModal, ...action.payload, },
      };
    },
  },
};
